package org.darcy.framework.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * 业务类型相关
 */
public class BusinessType {

	private static Map<String, String> data;

	/**
	 * 业务数据初始化
	 */
	static {
		if (data == null) {
			data = new HashMap<String, String>();
		}
		data.put(SysConstant.FormType.BusinessContract, "合同登记");
		data.put(SysConstant.FormType.ContractConfirm, "合同确认");
		data.put(SysConstant.FormType.FinancialReceived, "合同收款");
		data.put(SysConstant.FormType.FinancialBill, "申请开票");
		data.put(SysConstant.FormType.CheckReason, "检测依据");
		data.put(SysConstant.FormType.CheckPlan, "采样计划");
		// data.put("", "");
		data.put(SysConstant.FormType.CheckDelivery, "派工单");
		data.put(SysConstant.FormType.CheckCaiYang, "采样");
		data.put(SysConstant.FormType.CheckShouYang, "收样");
		data.put(SysConstant.FormType.CheckService, "现场服务");
		data.put(SysConstant.FormType.LibDispatch, "实验派工");
		data.put(SysConstant.FormType.LibAnalysis, "实验分析");
		data.put(SysConstant.FormType.LibReport, "实验报告");
		data.put(SysConstant.FormType.HandOver, "交付");
		data.put(SysConstant.FormType.CloseDept, "办公室结算");
		data.put(SysConstant.FormType.CloseFinancial, "财务结算");
		data.put(SysConstant.FormType.Archive, "归档");
		
		data.put(SysConstant.FormType.CheckChangDiao1, "场调（职业卫生）");
		data.put(SysConstant.FormType.CheckChangDiao2, "场调（验收）");
		data.put(SysConstant.FormType.CheckReport, "报告编制");
		data.put(SysConstant.FormType.ShowPublic, "公示");
		data.put(SysConstant.FormType.CheckService, "现场服务");
		
		data.put(SysConstant.FormType.LeaveCompany, "离职交接");
	}

	/**
	 * 根据业务名称获取业务编码
	 * 
	 * @param name 业务名称
	 */
	public static String getBusinessCode(String name) {
		for (String code : data.keySet()) {
			if (data.get(code).equals(name)) {
				return code;
			}
		}
		return null;
	}

	/**
	 * 根据业务编码获取业务名称
	 * 
	 * @param code 业务编码
	 */
	public static String getBusinessName(String code) {
		return data.get(code);
	}

}
